import { updateTab, getQueryTab } from '../tab'
export default async function onInputEnteredFn(text: string) {
    console.log('inputEntered: ' + text);
    var href = '';
    if (text.endsWith('后台')) href = 'https://myseller.taobao.com/home.htm#/index';
    else if (text.startsWith('百度搜索')) href = 'https://www.baidu.com/s?ie=UTF-8&wd=' + text.replace('百度搜索 ', '');
    else if (text.startsWith('谷歌搜索')) href = 'https://www.google.com.tw/search?q=' + text.replace('谷歌搜索 ', '');
    else href = 'https://www.baidu.com/s?ie=UTF-8&wd=' + text;
    let id = await getQueryTab({ active: true, currentWindow: true });
    if (id[0].id)
        updateTab(id[0].id, href);
}